﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DataBaseUpdate.UpdateDateBase2013
{
    public class UpdateDateBase201309
    {
        public UpdateDateBase201309() { }
        public List<string> list = new List<string>();
        public string Message;//全局变量，装载语句执行后返回信息

        public List<string> ExecuteSQL2013092201(bool IsExcute)
        {
            list = new List<string>();

            if (IsExcute)
            {
                string SQL = @"  IF NOT EXISTS (SELECT 1 FROM sysobjects WHERE id = object_id('TbEvlutionText') AND type ='U')
CREATE TABLE [dbo].[TbEvlutionText](
	[UniqueIdentifier] [varchar](50) NOT NULL primary key,
	[ID] [decimal](18, 0) IDENTITY(1,1) NOT NULL,
	[Name] [varchar](1000) NULL,
	[Code] [varchar](1000) NULL,
	[CreateDate] [datetime] NULL,
	[Remark] [varchar](2000) NULL)";
                Message = SqlHelper.ExcuteQueryReturnMessage(SQL, CommandType.Text);
            }
            list.Add("创建[TbEvlutionText]表:" + Message);
            return list;
        }

        public List<string> ExecuteSQL2013092202(bool IsExcute)
        {
            list = new List<string>();

            if (IsExcute)
            {
                string SQL = @"if NOT exists (select 1 from  sysobjects where  id = object_id('CsListItem') and   type = 'U')
create table CsListItem (
   ListItemIdentifier   varchar(100)         not null,
   ListItemName         varchar(500)         null,
   ListItemContent      varchar(2000)        null,
   ListItemRemark       varchar(2000)        null,
   constraint PK_CSLISTITEM primary key (ListItemIdentifier)
)";
                Message = SqlHelper.ExcuteQueryReturnMessage(SQL, CommandType.Text);
            }
            list.Add("创建[CsListItem]表:" + Message);
            return list;
        }
        public List<string> ExecuteSQL2013092203(bool IsExcute)
        {
            list = new List<string>();

            if (IsExcute)
            {
                string SQL = @"if NOT exists (select 1 from  sysobjects  where  id = object_id('CsInspectHouse')  and   type = 'U')
create table CsInspectHouse (
   InspectHouseIdentifier varchar(100)         null,
   InspectHouseNo       varchar(50)          null,
   InspectHouseDate     datetime             null,
   InspectHouseUnitNo   varchar(50)          null,
   InspectHouseSituation varchar(500)         null,
   InspectHouseAddress  varchar(200)         null,
   InspectHouseContact  varchar(100)         null,
   InspectHouseContactPhone varchar(250)         null,
   InspectHouseCreater  varchar(50)          null,
   InspectHouseCreatDate datetime             null,
   InspectHouseRemark   varchar(2000)        null
)";
                Message = SqlHelper.ExcuteQueryReturnMessage(SQL, CommandType.Text);
            }
            list.Add("创建[CsInspectHouse]表:" + Message);
            return list;
        }

        public List<string> ExecuteSQL2013092204(bool IsExcute)
        {
            list = new List<string>();

            if (IsExcute)
            {
                string SQL = @"if NOT exists (select 1 from  sysobjects where  id = object_id('CsAcceptItem')  and   type = 'U')
create table CsAcceptItem (
   AcceptItemIdentifier varchar(100)         null,
   ListItemIdentifier   varchar(100)         null,
   InspectHouseIdentifier varchar(100)         null,
   AcceptItemName       varchar(100)         null,
   AcceptItemContent    varchar(500)         null,
   AcceptItemIsQualified bit              null,
   AcceptItemSituation  varchar(500)         null,
   AcceptItemCharge     varchar(50)          null,
   AcceptItemChargeUnit varchar(100)         null,
   AcceptItemFinishDate datetime             null,
   AcceptItemRemark     varchar(2000)        null
)";
                Message = SqlHelper.ExcuteQueryReturnMessage(SQL, CommandType.Text);
            }
            list.Add("创建[CsAcceptItem]表:" + Message);
            return list;
        }

        public List<string> ExecuteSQL2013092205(bool IsExcute)
        {
            list = new List<string>();

            if (IsExcute)
            {
                string SQL = @"if Not exists (select 1 from  sysobjects where  id = object_id('SysUser')  and   type = 'U')
create table SysUser (
   UserIdentifier       varchar(100)         not null,
   UserName             varchar(500)         null,
   UserLoginID          varchar(100)         null,
   UserPwd              varchar(500)         null,
   UserTypeName    varchar(500)         null,
  OrganIdentifier		varchar(100)		null,
   constraint PK_SYSUSER primary key (UserIdentifier)
)";
                Message = SqlHelper.ExcuteQueryReturnMessage(SQL, CommandType.Text);
            }
            list.Add("创建[SysUser]表:" + Message);
            return list;
        }

        public List<string> ExecuteSQL2013092206(bool IsExcute)
        {
            list = new List<string>();

            if (IsExcute)
            {
                string SQL = @"if Not exists (select 1 from  sysobjects where  id = object_id('SysLog')  and   type = 'U')
create table SysLog (
   ID                   decimal              identity(1,1),
   DataText             text                 null,
   CreateDate           datetime             null,
   constraint PK_SYSLOG primary key (ID)
)
";
                Message = SqlHelper.ExcuteQueryReturnMessage(SQL, CommandType.Text);
            }
            list.Add("创建[SysLog]表:" + Message);
            return list;
        }
        public List<string> ExecuteSQL2013092801(bool IsExcute)
        {
            list = new List<string>();

            if (IsExcute)
            {
                string SQL = @"if Not exists (select 1 from  sysobjects  where  id = object_id('CsAppeal') and   type = 'U')
create table CsAppeal (
   AppealIdentities     varchar(100)    Primary key     not null,
   AppealCode           varchar(100)         null,
   AppealDate           datetime             null,
   AppealType           varchar(100)         null,
   AppealContent        varchar(3000)        null,
   AppealContact        varchar(200)         null,
   AppealContactPhone  varchar(200)         null,
   AppealAddress        varchar(1000)        null,
   AppealCreater        varchar(100)         null,
   AppealRemark         varchar(3000)        null
)
";
                Message = SqlHelper.ExcuteQueryReturnMessage(SQL, CommandType.Text);
            }
            list.Add("创建[CsAppeal]表:" + Message);
            return list;
        }


        public List<string> ExecuteSQL2013092802(bool IsExcute)
        {
            list = new List<string>();

            if (IsExcute)
            {
                string SQL = @"if Not exists (select 1 from  sysobjects  where  id = object_id('CsMaintenance') and   type = 'U')
Create Table CsMaintenance
(
	MaintenanceIdentities     varchar(100)    Primary key     not null,
	MaintenanceCode			varchar(100)		null,
	MaintenanceDate				datetime			null,
	MaintenanceType				varchar(100)		null,
	MaintenanceContent        varchar(3000)        null,
	MaintenanceContact        varchar(200)         null,
	MaintenanceContactPhone  varchar(200)         null,
   MaintenanceAddress        varchar(1000)        null,
   MaintenanceCreater        varchar(100)         null,
   MaintenanceRemark         varchar(3000)        null
)
";
                Message = SqlHelper.ExcuteQueryReturnMessage(SQL, CommandType.Text);
            }
            list.Add("创建[CsMaintenance]表:" + Message);
            return list;
        }

    }
}
